package com.jnc.core.web.page;

import com.jnc.common.constant.SysConstant;
import com.jnc.core.util.ServletUtil;

/**
 * @Author: jianning.jiang
 * @Date: Created in 2018/9/17 17:17
 * @Description: table数据处理类
 */
public class TableSupport {

    /**
     * 封装分页对象
     * @return
     */
    private static PageModel getPageModel(){
        PageModel model = new PageModel();
        model.setPageNum(ServletUtil.getParameterToInt(SysConstant.PAGE_NUM));
        model.setPageSize(ServletUtil.getParameterToInt(SysConstant.PAGE_SIZE));
        model.setOrderByColumn(ServletUtil.getParameter(SysConstant.ORDER_BY_COLUMN));
        model.setOrderRule(ServletUtil.getParameter(SysConstant.ORDER_RULE));
        return model;
    }

    /**
     * 构建分页对象
     * @return
     */
    public static PageModel buildPageRequest(){
        return getPageModel();
    }
}
